class Solution
{
public:
    int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f)
    {
        int minMove = 2;
        if (a == e)
        {
            if (c != e)
            {
                return 1;
            }
            else if (d < min(b, f) || d > max(b, f))
            {
                return 1;
            }
        }
        if (b == f)
        {
            if (d != f)
            {
                return 1;
            }
            else if (c < min(a, e) || c > max(a, e))
            {
                return 1;
            }
        }

        int dx1 = a - e;
        int dy1 = b - f;
        int dx2 = c - e;
        int dy2 = d - f;
        if (abs(dx2) == abs(dy2))
        {
            if (!(abs(dx1) == abs(dy1) && dx1 * dx2 > 0 && dy1 * dy2 > 0 && abs(dx1) < abs(dx2)))
            {
                return 1;
            }
        }
        return minMove;
    }
};